package com.carkeeper.storebill.listener;

import com.carkeeper.storebill.config.RabbitConfig;
import com.carkeeper.storebill.service.StoreBillService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class StoreBillPayListener {

    @Autowired
    StoreBillService storeBillService;

    @RabbitListener(queues = RabbitConfig.STORE_BILL_PAY)
    public void receiveMessage(String message){

        if (message == null){

            throw new RuntimeException("账单不存在");
        }

        storeBillService.PayStoreBillByCode(message);

    }
}
